home *** CD-ROM | disk | FTP | other *** search
/ C & C++ Multimedia Cyber Classroom / C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso / cpphtp2 / code.jar / code / ch03 / fig03_25.txt < prev    next >
Text File  |  1998-02-27  |  409b  |  17 lines

  1. 1   // Fig. 3.25: fig03_25.cpp
  2. 2   // Using overloaded functions
  3. 3   #include <iostream.h>
  4. 4   
  5. 5   int square( int x ) { return x * x; }
  6. 6   
  7. 7   double square( double y ) { return y * y; }
  8. 8   
  9. 9   int main()
  10. 10  {
  11. 11     cout << "The square of integer 7 is " << square( 7 )
  12. 12          << "\nThe square of double 7.5 is " << square( 7.5 ) 
  13. 13          << endl; 
  14. 14  
  15. 15     return 0;
  16. 16  }
  17.